import {defineConfig} from 'vite'
import Vue from '@vitejs/plugin-vue'
import path from 'path'
import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import {NaiveUiResolver} from 'unplugin-vue-components/resolvers'
import Unocss from 'unocss/vite'
import {presetAttributify, presetUno, presetIcons} from 'unocss'

export default defineConfig({
    base: '/admin/',
    build: {assetsDir: 'lib'},
    resolve: {alias: {'~/': `${path.resolve(__dirname, 'src')}/`}},
    plugins: [
        Vue({reactivityTransform: true}),
        Pages(),
        Layouts(),
        AutoImport({
            imports: [
                'vue',
                'vue/macros',
                'vue-router',
                '@vueuse/core',
            ],
        }),
        Components({resolvers: [NaiveUiResolver()]}),
        Unocss({
            presets: [
                presetAttributify({}),
                presetUno(),
                presetIcons({
                    warn: true,
                })
            ],
        })
    ]
})
